<html>
<head><meta charset="utf-8"><title>Stabilizing `std::default()` (default_free_fn)? · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html">Stabilizing `std::default()` (default_free_fn)?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="239702617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239702617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239702617">(May 21 2021 at 06:29)</a>:</h4>
<p>Any blockers or objections to starting an FCP to stabilize <code>std::default()</code>? <a href="https://github.com/rust-lang/rust/issues/73014">https://github.com/rust-lang/rust/issues/73014</a></p>



<a name="239703932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239703932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239703932">(May 21 2021 at 06:44)</a>:</h4>
<p>Well, the issue still lists this:</p>
<blockquote>
<p>This addition is likely to be stabilized only when we decide that direct import of trait methods is will not be supported.</p>
</blockquote>



<a name="239705562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239705562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239705562">(May 21 2021 at 07:03)</a>:</h4>
<p>i mean, if that happens, it could always be changed to be <code>pub use Default::default;</code>. Or it could be deprecated.</p>



<a name="239726151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239726151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239726151">(May 21 2021 at 10:07)</a>:</h4>
<p>Probably not really. You can say <code>default::&lt;T&gt;</code> but not for the method.</p>



<a name="239729312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239729312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239729312">(May 21 2021 at 10:36)</a>:</h4>
<p>I have objections</p>
<ul>
<li><code>default</code> is worse than <code>Default::default</code> unless it's put into prelude.</li>
<li><code>default</code> is only marginally better than <code>Default::default</code> if it <em>is</em> put into prelude</li>
<li>it's better to make progress with <code>Struct { field, .. }</code> sugar and not write <code>Default::default</code> in most cases</li>
<li>adding arbitrary low benefit aliases is a way to turn the library into a garbage dump making harder to find anything or make a choice</li>
</ul>



<a name="239769429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239769429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239769429">(May 21 2021 at 15:31)</a>:</h4>
<p>I support the first 3 of those bullet points</p>



<a name="239788744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239788744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239788744">(May 21 2021 at 17:51)</a>:</h4>
<p>I'd also really like to get the <code>.. }</code> sugar.  Any progress on that, <span class="user-mention" data-user-id="119031">@Esteban Küber</span>?  Anything that you need help with?</p>



<a name="239803063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239803063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239803063">(May 21 2021 at 19:40)</a>:</h4>
<p>So, I do agree that there's not much point unless we put it into the prelude. I'd love to see it in the prelude, though.</p>



<a name="239804339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239804339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239804339">(May 21 2021 at 19:52)</a>:</h4>
<p>What happened to the 2021 prelude? As I recall there were a bunch of things considered but the final cut lost everything except a few traits</p>



<a name="239804461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239804461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239804461">(May 21 2021 at 19:53)</a>:</h4>
<p>was it that non-trait inclusions to the prelude don't need an edition?</p>



<a name="239805227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239805227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239805227">(May 21 2021 at 19:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="271719">Mario Carneiro</span> <a href="#narrow/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault.28.29.60.20.28default_free_fn.29.3F/near/239804461">said</a>:</p>
<blockquote>
<p>was it that non-trait inclusions to the prelude don't need an edition?</p>
</blockquote>
<p>Yup.  It's just trait methods that cause conflicts -- adding, say, <code>HashMap</code> to the prelude doesn't affect you if you'd already done something like <code>use some_special::FancyHashMap as HashMap;</code>, as name resolution will prefer the non-prelude one.</p>



<a name="239806410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20%60std%3A%3Adefault%28%29%60%20%28default_free_fn%29%3F/near/239806410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20.60std.3A.3Adefault().60.20(default_free_fn).3F.html#239806410">(May 21 2021 at 20:07)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> I haven't made progress on that, but I might have some time soon to do just that</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>